Here we generate repeat the PCA analysis of PI uptake data (already done by Romain). The idea is to show the rationale of chosing the AUC as summary measure for the phenotype

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.3     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   2.0.0     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(tidymodels)
## Registered S3 method overwritten by 'tune':
##   method                   from   
##   required_pkgs.model_spec parsnip
## ── Attaching packages ────────────────────────────────────── tidymodels 0.1.3 ──
## ✓ broom        0.7.9      ✓ rsample      0.1.0 
## ✓ dials        0.0.9      ✓ tune         0.1.6 
## ✓ infer        1.0.0      ✓ workflows    0.2.3 
## ✓ modeldata    0.1.1      ✓ workflowsets 0.1.0 
## ✓ parsnip      0.1.7      ✓ yardstick    0.0.8 
## ✓ recipes      0.1.16
## ── Conflicts ───────────────────────────────────────── tidymodels_conflicts() ──
## x scales::discard() masks purrr::discard()
## x dplyr::filter()   masks stats::filter()
## x recipes::fixed()  masks stringr::fixed()
## x dplyr::lag()      masks stats::lag()
## x yardstick::spec() masks readr::spec()
## x recipes::step()   masks stats::step()
## • Use tidymodels_prefer() to resolve common conflicts.
library(skimr)
library(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(adegenet)
## Loading required package: ade4
## Registered S3 method overwritten by 'vegan':
##   method          from   
##   print.nullmodel parsnip
## 
##    /// adegenet 2.1.5 is loaded ////////////
## 
##    > overview: '?adegenet'
##    > tutorials/doc/questions: 'adegenetWeb()' 
##    > bug reports/feature requests: adegenetIssues()
library(randomForest)
## randomForest 4.6-14
## Type rfNews() to see new features/changes/bug fixes.
## 
## Attaching package: 'randomForest'
## The following object is masked from 'package:dplyr':
## 
##     combine
## The following object is masked from 'package:ggplot2':
## 
##     margin
library(cluster)
library(caret)
## Warning: package 'caret' was built under R version 4.1.2
## Loading required package: lattice
## 
## Attaching package: 'caret'
## The following objects are masked from 'package:yardstick':
## 
##     precision, recall, sensitivity, specificity
## The following object is masked from 'package:purrr':
## 
##     lift
library(patchwork)
library(corrr)
## 
## Attaching package: 'corrr'
## The following object is masked from 'package:skimr':
## 
##     focus
rm(list = ls())

source("../../Functions/all_functions.R")
## 
## Attaching package: 'magrittr'
## The following object is masked from 'package:purrr':
## 
##     set_names
## The following object is masked from 'package:tidyr':
## 
##     extract
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:randomForest':
## 
##     combine
## The following object is masked from 'package:dplyr':
## 
##     combine
## Loading required package: here
## here() starts at /Users/giulieris/OneDrive - The University of Melbourne/R/VANANZ_phenotypes_github

Import summary PI data

PI_parameters <- readRDS("../../Genetic_pairs_analysis_Oct_2020/processed_data/PI/dataframes/parameters/PI_sample_parameters.Rda")

We keep clinical isolates only (BPHXXXX). Also we reformat as tibble

PI_parameters <- PI_parameters %>%
  as_tibble() %>%
  filter(str_detect(sample_id, "BPH"))

unique(PI_parameters$sample_id)
##   [1] BPH2700 BPH2701 BPH2702 BPH2703 BPH2704 BPH2705 BPH2706 BPH2707 BPH2708
##  [10] BPH2709 BPH2710 BPH2711 BPH2712 BPH2713 BPH2714 BPH2715 BPH2716 BPH2717
##  [19] BPH2718 BPH2719 BPH2720 BPH2721 BPH2722 BPH2723 BPH2724 BPH2725 BPH2726
##  [28] BPH2727 BPH2728 BPH2729 BPH2730 BPH2731 BPH2732 BPH2733 BPH2734 BPH2735
##  [37] BPH2736 BPH2737 BPH2738 BPH2739 BPH2740 BPH2741 BPH2742 BPH2743 BPH2744
##  [46] BPH2745 BPH2746 BPH2747 BPH2748 BPH2749 BPH2750 BPH2751 BPH2752 BPH2753
##  [55] BPH2754 BPH2755 BPH2756 BPH2757 BPH2758 BPH2759 BPH2760 BPH2761 BPH2762
##  [64] BPH2763 BPH2764 BPH2765 BPH2766 BPH2767 BPH2768 BPH2769 BPH2770 BPH2771
##  [73] BPH2773 BPH2774 BPH2775 BPH2776 BPH2777 BPH2778 BPH2779 BPH2780 BPH2781
##  [82] BPH2782 BPH2783 BPH2784 BPH2785 BPH2786 BPH2787 BPH2788 BPH2789 BPH2790
##  [91] BPH2791 BPH2792 BPH2793 BPH2794 BPH2795 BPH2796 BPH2797 BPH2798 BPH2799
## [100] BPH2800 BPH2801 BPH2802 BPH2803 BPH2804 BPH2805 BPH2806 BPH2807 BPH2808
## [109] BPH2809 BPH2810 BPH2811 BPH2812 BPH2813 BPH2814 BPH2815 BPH2816 BPH2817
## [118] BPH2818 BPH2819 BPH2820 BPH2821 BPH2822 BPH2823 BPH2824 BPH2825 BPH2827
## [127] BPH2828 BPH2829 BPH2830 BPH2831 BPH2832 BPH2833 BPH2834 BPH2835 BPH2836
## [136] BPH2837 BPH2838 BPH2839 BPH2840 BPH2841 BPH2842 BPH2843 BPH2844 BPH2845
## [145] BPH2846 BPH2847 BPH2848 BPH2849 BPH2850 BPH2851 BPH2852 BPH2853 BPH2854
## [154] BPH2855 BPH2856 BPH2857 BPH2858 BPH2859 BPH2860 BPH2861 BPH2862 BPH2863
## [163] BPH2864 BPH2865 BPH2866 BPH2867 BPH2869 BPH2872 BPH2873 BPH2876 BPH2877
## [172] BPH2881 BPH2882 BPH2883 BPH2884 BPH2887 BPH2888 BPH2890 BPH2891 BPH2896
## [181] BPH2897 BPH2898 BPH2902 BPH2904 BPH2907 BPH2922 BPH2923 BPH2924 BPH2925
## [190] BPH2926 BPH2934 BPH2938 BPH2942 BPH2943 BPH2946 BPH2947 BPH2948 BPH2949
## [199] BPH2952 BPH2953 BPH2959 BPH2960 BPH2961 BPH2962 BPH2963 BPH2964 BPH2965
## [208] BPH2966 BPH2973 BPH2974 BPH2975 BPH2976 BPH2977 BPH2978 BPH2979 BPH2980
## [217] BPH2981 BPH2982 BPH2987 BPH2988 BPH2989 BPH2990 BPH2991 BPH3202 BPH3204
## [226] BPH3208 BPH3216 BPH3220 BPH3225 BPH3226 BPH3236 BPH3244 BPH3246 BPH3250
## [235] BPH3252 BPH3258 BPH3260 BPH3262 BPH3268 BPH3270 BPH3272 BPH3274 BPH3276
## [244] BPH3282 BPH3284 BPH3292 BPH3294 BPH3304 BPH3306 BPH3316 BPH3320 BPH3328
## [253] BPH3332 BPH3336 BPH3337 BPH3338 BPH3340 BPH3346 BPH3348 BPH3350 BPH3352
## [262] BPH3356 BPH3358 BPH3360 BPH3361 BPH3362 BPH3366 BPH3367 BPH3368 BPH3370
## [271] BPH3372 BPH3376 BPH3381 BPH3382 BPH3383 BPH3384 BPH3389 BPH3394 BPH3396
## [280] BPH3401 BPH3403 BPH3412 BPH3413 BPH3415 BPH3416 BPH3417 BPH3423 BPH3425
## [289] BPH3427 BPH3431 BPH3433 BPH3434 BPH3435 BPH3437 BPH3439 BPH3443 BPH3448
## [298] BPH3451 BPH3453 BPH3457 BPH3459 BPH3460 BPH3462 BPH3463 BPH3465 BPH3469
## [307] BPH3473 BPH3477 BPH3479 BPH3481 BPH3482 BPH3485 BPH3489 BPH3493 BPH3499
## [316] BPH3501 BPH3508 BPH3511 BPH3523 BPH3524 BPH3527 BPH3529 BPH3535 BPH3545
## [325] BPH3547 BPH3548 BPH3568 BPH3584 BPH3588 BPH3590 BPH3596 BPH3602 BPH3612
## [334] BPH3628 BPH3632 BPH3634 BPH3636 BPH3638 BPH3640 BPH3643 BPH3648 BPH3650
## [343] BPH3652 BPH3658 BPH3660 BPH3662 BPH3664 BPH3666 BPH3668 BPH3670 BPH3672
## [352] BPH3674 BPH3682 BPH3684 BPH3686 BPH3688 BPH3692 BPH3694 BPH3696 BPH3700
## [361] BPH3702 BPH3704 BPH3706 BPH3710 BPH3733 BPH3734 BPH3735 BPH3736 BPH3737
## [370] BPH3738 BPH3739 BPH3741 BPH3742 BPH3743 BPH3744 BPH3745 BPH3746 BPH3747
## [379] BPH3748 BPH3749 BPH3750 BPH3751 BPH3752 BPH3753 BPH3754 BPH3755 BPH3757
## 394 Levels: JE2 NE1354 TOX-4 NEB agrA Non infected Complete lysis ... Blank
skim(PI_parameters)
Data summary
Name PI_parameters
Number of rows 387
Number of columns 51
_______________________
Column type frequency:
factor 1
numeric 50
________________________
Group variables None

Variable type: factor

skim_variable n_missing complete_rate ordered n_unique top_counts
sample_id 0 1 FALSE 387 BPH: 1, BPH: 1, BPH: 1, BPH: 1

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
time_of_max_rate_death_mean 0 1 550.10 196.57 191.00 396.50 508.80 663.00 1104.00 ▅▇▅▃▁
max_rate_death_mean 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.01 ▇▇▃▁▁
doubling_time_death_mean 0 1 -2881.67 75202.43 -1478120.75 292.67 437.69 861.16 19087.26 ▁▁▁▁▇
AUC_death_mean 0 1 73.20 47.59 -10.73 35.46 69.95 103.74 204.69 ▆▇▇▃▁
time_of_max_death_mean 0 1 899.66 243.02 0.00 756.50 980.00 1104.00 1104.00 ▁▁▂▂▇
max_death_mean 0 1 0.81 0.44 0.02 0.47 0.81 1.08 2.20 ▆▇▇▂▁
time_of_min_death_mean 0 1 165.83 104.54 0.00 112.40 157.00 197.40 1091.00 ▇▂▁▁▁
min_death_mean 0 1 -0.02 0.05 -0.14 -0.04 -0.02 0.01 0.19 ▁▇▅▁▁
end_point_death_mean 0 1 0.72 0.41 -0.02 0.42 0.73 0.97 2.20 ▅▇▆▁▁
end_point_timepoint_death_mean 0 1 1104.00 0.00 1104.00 1104.00 1104.00 1104.00 1104.00 ▁▁▇▁▁
time_of_max_rate_death_sd 0 1 103.69 91.67 0.00 32.30 74.86 142.09 500.63 ▇▃▁▁▁
max_rate_death_sd 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▇▂▁▁▁
doubling_time_death_sd 0 1 9571.15 177881.61 11.40 53.47 125.83 344.83 3499666.74 ▇▁▁▁▁
AUC_death_sd 0 1 20.65 15.54 2.04 10.42 16.50 25.13 126.55 ▇▂▁▁▁
time_of_max_death_sd 0 1 119.32 163.03 0.00 0.00 62.75 140.20 780.65 ▇▁▁▁▁
max_death_sd 0 1 0.19 0.15 0.02 0.10 0.16 0.24 1.22 ▇▂▁▁▁
time_of_min_death_sd 0 1 52.46 56.11 0.00 22.56 37.69 58.41 416.40 ▇▁▁▁▁
min_death_sd 0 1 0.06 0.03 0.01 0.03 0.05 0.07 0.25 ▇▃▁▁▁
end_point_death_sd 0 1 0.18 0.15 0.02 0.08 0.14 0.22 1.13 ▇▂▁▁▁
end_point_timepoint_death_sd 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▁▁▇▁▁
time_of_max_rate_death_median 0 1 546.43 203.62 216.00 384.00 510.00 667.50 1104.00 ▆▇▅▃▁
max_rate_death_median 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.01 ▇▇▃▁▁
doubling_time_death_median 0 1 758.73 1836.63 -24779.46 275.82 420.58 783.44 16089.53 ▁▁▁▇▁
AUC_death_median 0 1 72.50 48.11 -14.25 34.90 67.36 104.64 205.83 ▅▇▇▃▁
time_of_max_death_median 0 1 924.67 265.43 0.00 811.50 1104.00 1104.00 1104.00 ▁▁▁▂▇
max_death_median 0 1 0.80 0.45 0.02 0.47 0.81 1.08 2.26 ▆▇▆▂▁
time_of_min_death_median 0 1 162.16 101.98 0.00 114.00 153.00 198.00 1104.00 ▇▂▁▁▁
min_death_median 0 1 -0.02 0.04 -0.16 -0.05 -0.03 0.00 0.15 ▁▅▇▁▁
end_point_death_median 0 1 0.72 0.41 -0.03 0.43 0.73 0.97 2.26 ▅▇▅▁▁
end_point_timepoint_death_median 0 1 1104.00 0.00 1104.00 1104.00 1104.00 1104.00 1104.00 ▁▁▇▁▁
time_of_max_rate_death_mad 0 1 79.66 86.12 0.00 22.24 48.93 113.42 524.84 ▇▂▁▁▁
max_rate_death_mad 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▇▂▁▁▁
doubling_time_death_mad 0 1 420.86 2136.83 2.97 40.66 104.96 277.86 32803.16 ▇▁▁▁▁
AUC_death_mad 0 1 20.18 19.20 0.24 8.51 14.39 24.06 149.82 ▇▁▁▁▁
time_of_max_death_mad 0 1 56.41 113.24 0.00 0.00 0.00 71.16 818.40 ▇▁▁▁▁
max_death_mad 0 1 0.19 0.18 0.01 0.07 0.14 0.24 1.62 ▇▁▁▁▁
time_of_min_death_mad 0 1 41.73 41.34 0.00 17.79 26.69 53.37 280.21 ▇▂▁▁▁
min_death_mad 0 1 0.05 0.03 0.00 0.02 0.04 0.06 0.21 ▇▅▁▁▁
end_point_death_mad 0 1 0.17 0.17 0.00 0.07 0.12 0.22 1.35 ▇▁▁▁▁
end_point_timepoint_death_mad 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▁▁▇▁▁
time_of_max_rate_death_IQR 0 1 120.18 119.69 0.00 36.00 78.00 173.25 745.50 ▇▂▁▁▁
max_rate_death_IQR 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.01 ▇▁▁▁▁
doubling_time_death_IQR 0 1 920.88 7624.67 6.73 52.41 136.89 375.77 143946.70 ▇▁▁▁▁
AUC_death_IQR 0 1 26.05 24.43 1.44 10.81 19.25 30.87 198.41 ▇▁▁▁▁
time_of_max_death_IQR 0 1 131.48 229.89 0.00 0.00 45.00 156.00 1104.00 ▇▁▁▁▁
max_death_IQR 0 1 0.24 0.23 0.01 0.09 0.18 0.30 2.15 ▇▁▁▁▁
time_of_min_death_IQR 0 1 56.55 57.19 0.00 23.25 37.50 72.75 499.50 ▇▁▁▁▁
min_death_IQR 0 1 0.06 0.04 0.00 0.03 0.05 0.07 0.34 ▇▂▁▁▁
end_point_death_IQR 0 1 0.22 0.21 0.01 0.08 0.16 0.27 1.79 ▇▁▁▁▁
end_point_timepoint_death_IQR 0 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ▁▁▇▁▁

Inspect/visualise/assess distributions

vars <- sort(colnames(PI_parameters[-1]))
plot_list <- list()
for (v in vars) {
  s <- rlang::sym(v)
  
  p <- PI_parameters %>%
    ggplot(aes(x = {{s}})) +
    geom_histogram() +
    theme_bw()
  
  plot_list[[v]] <- p
}

wrap_plots(plot_list, ncol = 5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggsave("figures/all_vars_histograms.png", width = 12, height = 16)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Alternative representation

PI_parameters %>%
  pivot_longer(cols = -sample_id, names_to = "parameter_stat", values_to = "value") %>%
  mutate(parameter =  str_match(parameter_stat, "(.*)_([^_]*)")[,2],
         statistic = str_match(parameter_stat, "(.*)_([^_]*)")[,3]) %>%
  select(-parameter_stat) %>%
  ggplot(aes(x = value)) +
  geom_histogram() +
  facet_grid(statistic~parameter, scales = "free")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Remove variable with no variance and doubling time (this is just a different representaiton of death rate)

PI_parameters <- PI_parameters %>%
  select(-c(contains("end_point_timepoint"), 
            contains("doubling_time")))

Repeat histograms

PI_parameters %>%
  pivot_longer(cols = -sample_id, names_to = "parameter_stat", values_to = "value") %>%
  mutate(parameter =  str_match(parameter_stat, "(.*)_([^_]*)")[,2],
         statistic = str_match(parameter_stat, "(.*)_([^_]*)")[,3]) %>%
  select(-parameter_stat) %>%
  ggplot(aes(x = value)) +
  geom_histogram() +
  facet_grid(statistic~parameter, scales = "free") +
  theme_bw()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggsave("figures/all_vars_histograms_facet_grid.png")
## Saving 7 x 5 in image
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
PI_parameters %>%
  pivot_longer(cols = -sample_id, names_to = "parameter_stat", values_to = "value") %>%
  mutate(parameter =  str_match(parameter_stat, "(.*)_([^_]*)")[,2],
         statistic = str_match(parameter_stat, "(.*)_([^_]*)")[,3]) %>%
  select(-parameter_stat) %>%
  ggplot(aes(x = value)) +
  geom_histogram() +
   facet_wrap(parameter~statistic, scales = "free", ncol = 5) +
  theme_bw()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggsave("figures/all_vars_histograms_facet_wrap.png", width = 9, height = 11)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Assess correlations: all parameters

corr <- PI_parameters %>%
  select(-c(sample_id)) %>%
  correlate() 
## 
## Correlation method: 'pearson'
## Missing treated using: 'pairwise.complete.obs'
corr %>%
  rearrange() %>%
  shave() %>%
  # rplot(shape = 15, colours = c("darkorange", "white", "darkcyan")) +
  rplot(colours = c("red", "white", "blue")) +
  theme(axis.text.x = element_text(angle = 90))
## Registered S3 method overwritten by 'seriation':
##   method         from 
##   reorder.hclust vegan
## Don't know how to automatically pick scale for object of type noquote. Defaulting to continuous.

corr %>%
  network_plot(min_cor = .3)
## Warning: ggrepel: 8 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

# get order
order_vars <- corr %>%
  rearrange() %>%
  .$term

# corr %>%
#   stretch() %>%
#   mutate(x = fct_relevel(x, order_vars)) %>%
#   ggplot(aes(x, abs(r))) +
#  geom_point(alpha = .3, size = 3) +
#    stat_summary(fun = "mean", geom = "pointrange", colour = "black", width = .3) +
#   stat_summary(fun.data = "mean_sdl", fun.args = list(mult = 1), geom = "errorbar", colour = "black", width = .2)

Ass correlations: mean only

corr <- PI_parameters %>%
  select(-c(sample_id)) %>%
  select(ends_with("mean")) %>%
  correlate() 
## 
## Correlation method: 'pearson'
## Missing treated using: 'pairwise.complete.obs'
corr %>%
  rearrange() %>%
  shave() %>%
  # rplot(shape = 15, colours = c("darkorange", "white", "darkcyan")) +
  rplot(colours = c("red", "white", "blue")) +
  theme(axis.text.x = element_text(angle = 90))
## Don't know how to automatically pick scale for object of type noquote. Defaulting to continuous.

corr %>%
  network_plot(min_cor = .3)

# get order
order_vars <- corr %>%
  rearrange() %>%
  .$term

# corr %>%
#   stretch() %>%
#   mutate(x = fct_relevel(x, order_vars)) %>%
#   ggplot(aes(x, abs(r))) +
#  geom_point(alpha = .3, size = 3) +
#    stat_summary(fun = "mean", geom = "pointrange", colour = "black", width = .3) +
#   stat_summary(fun.data = "mean_sdl", fun.args = list(mult = 1), geom = "errorbar", colour = "black", width = .2)

Pairwise correlations

PI_parameters %>%
  select(-sample_id) %>%
  select(ends_with("mean")) %>%
  ggplot() +
  ggforce::geom_autopoint() +
  ggforce::geom_autodensity(alpha = .3) +
  ggforce::facet_matrix(vars(everything()), 
                        layer.diag = 2) +
  theme_bw()

Other exploration

consider exploring variation within JE2

JE2_parameters <- readRDS("../../Genetic_pairs_analysis_Oct_2020/processed_data/PI/dataframes/parameters/PI_parameters.Rda") %>%
  filter(sample_id == "JE2") %>%
  select(-c(contains("end_point_timepoint"), 
            contains("doubling_time"))) %>%
 select(well_id:end_point_death)

JE2_parameters %>%
  pivot_longer(cols = -well_id, names_to = "parameter", values_to = "value") %>%
  ggplot(aes(x = value)) +
  geom_histogram() +
  facet_wrap(~parameter, scales = "free") +
  theme_bw()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

scale_recipe <- recipe(~ ., data = JE2_parameters) %>%
  update_role(well_id, new_role = "id") %>%
  step_normalize(all_predictors())

JE2_norm <- prep(scale_recipe) %>%
  bake(new_data = NULL)

JE2_norm %>%
  pivot_longer(cols = -well_id, names_to = "parameter", values_to = "value") %>%
  ggplot(aes(x = value)) +
  geom_histogram() +
  facet_wrap(~parameter) +
  theme_bw()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

JE2_norm %>%
  pivot_longer(cols = -well_id, names_to = "parameter", values_to = "value") %>%
  ggplot(aes(x = value, fill = parameter)) +
  geom_density(alpha = .5) +
  facet_wrap(~parameter) +
  theme_bw()

# Correlations
corr <- JE2_parameters %>%
  select(-c(well_id)) %>%
  correlate() 
## 
## Correlation method: 'pearson'
## Missing treated using: 'pairwise.complete.obs'
corr %>%
  rearrange() %>%
  shave() %>%
  # rplot(shape = 15, colours = c("darkorange", "white", "darkcyan")) +
  rplot(colours = c("red", "white", "blue")) +
  theme(axis.text.x = element_text(angle = 90))
## Don't know how to automatically pick scale for object of type noquote. Defaulting to continuous.

JE2_parameters %>%
  select(-well_id) %>%
  ggplot() +
  ggforce::geom_autopoint() +
  ggforce::geom_autodensity(alpha = .3) +
  ggforce::facet_matrix(vars(everything()), 
                        layer.diag = 2) +
  theme_bw()

First attempt to perform a PCA

pi_recipe <- recipe( ~ ., data = PI_parameters) %>%
  update_role(sample_id, new_role = "id") %>%
  step_normalize(all_predictors())%>%
  step_zv(all_predictors()) 

# pi_recipe <- pi_recipe %>%
#   step_corr(all_predictors())

pi_prep <- prep(pi_recipe)

pi_prep
## Data Recipe
## 
## Inputs:
## 
##       role #variables
##         id          1
##  predictor         40
## 
## Training data contained 387 data points and no missing data.
## 
## Operations:
## 
## Centering and scaling for 40 items [trained]
## Zero variance filter removed no terms [trained]
pi_pca_recipe <- pi_recipe %>%
  step_pca(all_predictors(), num_comp = 5)

pi_pca_estimates <- prep(pi_pca_recipe)

names(pi_pca_estimates)
## [1] "var_info"       "term_info"      "steps"          "template"      
## [5] "levels"         "retained"       "tr_info"        "orig_lvls"     
## [9] "last_term_info"
pi_pca_estimates[[1]]
## # A tibble: 41 × 4
##    variable                    type    role      source  
##    <chr>                       <chr>   <chr>     <chr>   
##  1 sample_id                   nominal id        original
##  2 time_of_max_rate_death_mean numeric predictor original
##  3 max_rate_death_mean         numeric predictor original
##  4 AUC_death_mean              numeric predictor original
##  5 time_of_max_death_mean      numeric predictor original
##  6 max_death_mean              numeric predictor original
##  7 time_of_min_death_mean      numeric predictor original
##  8 min_death_mean              numeric predictor original
##  9 end_point_death_mean        numeric predictor original
## 10 time_of_max_rate_death_sd   numeric predictor original
## # … with 31 more rows
pi_pca_estimates[[2]]
## # A tibble: 6 × 4
##   variable  type    role      source  
##   <chr>     <chr>   <chr>     <chr>   
## 1 sample_id nominal id        original
## 2 PC1       numeric predictor derived 
## 3 PC2       numeric predictor derived 
## 4 PC3       numeric predictor derived 
## 5 PC4       numeric predictor derived 
## 6 PC5       numeric predictor derived
pi_pca_estimates[[3]]
## [[1]]
## $terms
## <list_of<quosure>>
## 
## [[1]]
## <quosure>
## expr: ^all_predictors()
## env:  0x7f88811a5ba8
## 
## 
## $role
## [1] NA
## 
## $trained
## [1] TRUE
## 
## $means
##   time_of_max_rate_death_mean           max_rate_death_mean 
##                  5.501018e+02                  1.958288e-03 
##                AUC_death_mean        time_of_max_death_mean 
##                  7.320013e+01                  8.996582e+02 
##                max_death_mean        time_of_min_death_mean 
##                  8.131701e-01                  1.658304e+02 
##                min_death_mean          end_point_death_mean 
##                 -1.571606e-02                  7.245223e-01 
##     time_of_max_rate_death_sd             max_rate_death_sd 
##                  1.036934e+02                  5.648913e-04 
##                  AUC_death_sd          time_of_max_death_sd 
##                  2.065477e+01                  1.193247e+02 
##                  max_death_sd          time_of_min_death_sd 
##                  1.918859e-01                  5.245952e+01 
##                  min_death_sd            end_point_death_sd 
##                  5.507049e-02                  1.780995e-01 
## time_of_max_rate_death_median         max_rate_death_median 
##                  5.464341e+02                  1.905711e-03 
##              AUC_death_median      time_of_max_death_median 
##                  7.249911e+01                  9.246744e+02 
##              max_death_median      time_of_min_death_median 
##                  8.049519e-01                  1.621628e+02 
##              min_death_median        end_point_death_median 
##                 -1.963317e-02                  7.170162e-01 
##    time_of_max_rate_death_mad            max_rate_death_mad 
##                  7.965814e+01                  5.127980e-04 
##                 AUC_death_mad         time_of_max_death_mad 
##                  2.017648e+01                  5.640776e+01 
##                 max_death_mad         time_of_min_death_mad 
##                  1.880812e-01                  4.173117e+01 
##                 min_death_mad           end_point_death_mad 
##                  4.610827e-02                  1.716101e-01 
##    time_of_max_rate_death_IQR            max_rate_death_IQR 
##                  1.201822e+02                  6.790037e-04 
##                 AUC_death_IQR         time_of_max_death_IQR 
##                  2.604592e+01                  1.314845e+02 
##                 max_death_IQR         time_of_min_death_IQR 
##                  2.396494e-01                  5.655039e+01 
##                 min_death_IQR           end_point_death_IQR 
##                  6.063238e-02                  2.182760e-01 
## 
## $sds
##   time_of_max_rate_death_mean           max_rate_death_mean 
##                  1.965723e+02                  1.341923e-03 
##                AUC_death_mean        time_of_max_death_mean 
##                  4.758857e+01                  2.430218e+02 
##                max_death_mean        time_of_min_death_mean 
##                  4.438981e-01                  1.045409e+02 
##                min_death_mean          end_point_death_mean 
##                  4.633149e-02                  4.068496e-01 
##     time_of_max_rate_death_sd             max_rate_death_sd 
##                  9.167455e+01                  5.246706e-04 
##                  AUC_death_sd          time_of_max_death_sd 
##                  1.554191e+01                  1.630348e+02 
##                  max_death_sd          time_of_min_death_sd 
##                  1.484053e-01                  5.611372e+01 
##                  min_death_sd            end_point_death_sd 
##                  3.394541e-02                  1.470904e-01 
## time_of_max_rate_death_median         max_rate_death_median 
##                  2.036154e+02                  1.333770e-03 
##              AUC_death_median      time_of_max_death_median 
##                  4.811125e+01                  2.654305e+02 
##              max_death_median      time_of_min_death_median 
##                  4.461565e-01                  1.019776e+02 
##              min_death_median        end_point_death_median 
##                  4.437947e-02                  4.074348e-01 
##    time_of_max_rate_death_mad            max_rate_death_mad 
##                  8.612052e+01                  5.413430e-04 
##                 AUC_death_mad         time_of_max_death_mad 
##                  1.920124e+01                  1.132352e+02 
##                 max_death_mad         time_of_min_death_mad 
##                  1.770653e-01                  4.134239e+01 
##                 min_death_mad           end_point_death_mad 
##                  3.302163e-02                  1.681778e-01 
##    time_of_max_rate_death_IQR            max_rate_death_IQR 
##                  1.196943e+02                  7.287158e-04 
##                 AUC_death_IQR         time_of_max_death_IQR 
##                  2.443244e+01                  2.298868e+02 
##                 max_death_IQR         time_of_min_death_IQR 
##                  2.257653e-01                  5.719444e+01 
##                 min_death_IQR           end_point_death_IQR 
##                  4.488527e-02                  2.139884e-01 
## 
## $na_rm
## [1] TRUE
## 
## $skip
## [1] FALSE
## 
## $id
## [1] "normalize_pz12i"
## 
## attr(,"class")
## [1] "step_normalize" "step"          
## 
## [[2]]
## $terms
## <list_of<quosure>>
## 
## [[1]]
## <quosure>
## expr: ^all_predictors()
## env:  0x7f88811a5b00
## 
## 
## $role
## [1] NA
## 
## $trained
## [1] TRUE
## 
## $removals
## character(0)
## 
## $skip
## [1] FALSE
## 
## $id
## [1] "zv_G9nMT"
## 
## attr(,"class")
## [1] "step_zv" "step"   
## 
## [[3]]
## $terms
## <list_of<quosure>>
## 
## [[1]]
## <quosure>
## expr: ^all_predictors()
## env:  0x7f88931df2d8
## 
## 
## $role
## [1] "predictor"
## 
## $trained
## [1] TRUE
## 
## $num_comp
## [1] 5
## 
## $threshold
## [1] NA
## 
## $options
## list()
## 
## $res
## Standard deviations (1, .., p=40):
##  [1] 3.54577720 2.66982286 1.97605324 1.67739791 1.46964831 1.34310867
##  [7] 1.30985525 1.24209765 1.13330362 0.95094993 0.81468003 0.74307160
## [13] 0.69814534 0.61818757 0.55972036 0.50394965 0.47495634 0.44565948
## [19] 0.40196519 0.39208091 0.33919261 0.32778035 0.30896725 0.28441102
## [25] 0.27159196 0.22490412 0.21556490 0.19885810 0.18766593 0.17775757
## [31] 0.15275689 0.13091510 0.11749917 0.11557299 0.10836242 0.09488886
## [37] 0.08384530 0.05393785 0.05212885 0.02854117
## 
## Rotation (n x k) = (40 x 40):
##                                        PC1          PC2          PC3
## time_of_max_rate_death_mean    0.026682302  0.216345954  0.220688667
## max_rate_death_mean           -0.209422160 -0.167491410 -0.154358848
## AUC_death_mean                -0.213137015 -0.188959327 -0.149698317
## time_of_max_death_mean        -0.040589370 -0.011181093  0.355411000
## max_death_mean                -0.234737693 -0.137551687 -0.035755892
## time_of_min_death_mean         0.108165869  0.226317657 -0.039378786
## min_death_mean                 0.008039690  0.059680411 -0.085333570
## end_point_death_mean          -0.227354531 -0.106267715  0.070182438
## time_of_max_rate_death_sd      0.030598195  0.255518207 -0.036626429
## max_rate_death_sd             -0.218844393  0.072927302 -0.060558517
## AUC_death_sd                  -0.222834854  0.138528040 -0.019946076
## time_of_max_death_sd           0.070083215  0.154131151 -0.249160944
## max_death_sd                  -0.226761792  0.162275206  0.096629073
## time_of_min_death_sd           0.026151607  0.223942788 -0.185394497
## min_death_sd                  -0.042241559  0.112430548 -0.244674943
## end_point_death_sd            -0.204779250  0.167787210  0.149397666
## time_of_max_rate_death_median  0.022540885  0.196523191  0.222952569
## max_rate_death_median         -0.203253625 -0.176904286 -0.157417621
## AUC_death_median              -0.212552779 -0.188496185 -0.155366354
## time_of_max_death_median      -0.022960328  0.024838588  0.323758239
## max_death_median              -0.233936067 -0.140683545 -0.041382197
## time_of_min_death_median       0.098125533  0.205465220 -0.009640868
## min_death_median               0.007077048  0.045131258 -0.053634956
## end_point_death_median        -0.225230023 -0.108855151  0.065123223
## time_of_max_rate_death_mad     0.008337961  0.236149780 -0.044729230
## max_rate_death_mad            -0.217890756  0.042785980 -0.077876424
## AUC_death_mad                 -0.213786535  0.149494320 -0.026913173
## time_of_max_death_mad          0.001790993  0.008318788 -0.242009324
## max_death_mad                 -0.224715469  0.161420279  0.081170327
## time_of_min_death_mad         -0.002707326  0.224519124 -0.152951101
## min_death_mad                 -0.024262655  0.089453779 -0.238966405
## end_point_death_mad           -0.205168467  0.162303769  0.142389152
## time_of_max_rate_death_IQR     0.019006843  0.238725839 -0.018476326
## max_rate_death_IQR            -0.223147914  0.053325539 -0.078740404
## AUC_death_IQR                 -0.221953790  0.145687147 -0.014870832
## time_of_max_death_IQR          0.048905212  0.108145984 -0.229529786
## max_death_IQR                 -0.230778290  0.158760726  0.086313676
## time_of_min_death_IQR         -0.010774321  0.213759237 -0.172689993
## min_death_IQR                 -0.026857886  0.102638932 -0.257355860
## end_point_death_IQR           -0.213474887  0.162832902  0.142424353
##                                        PC4         PC5          PC6
## time_of_max_rate_death_mean   -0.127542135  0.21241212 -0.212954149
## max_rate_death_mean           -0.005359208  0.18560231 -0.064470663
## AUC_death_mean                -0.074005997  0.05574393 -0.019787868
## time_of_max_death_mean        -0.255552425 -0.09646876  0.284861017
## max_death_mean                -0.112063283  0.16563876 -0.103206969
## time_of_min_death_mean         0.080934981  0.10487982 -0.407325127
## min_death_mean                -0.253531594 -0.45934019 -0.174001949
## end_point_death_mean          -0.171393139  0.12382435 -0.039711890
## time_of_max_rate_death_sd     -0.083453627  0.11094902  0.087885065
## max_rate_death_sd              0.104714878 -0.01870825  0.016440850
## AUC_death_sd                   0.049764390 -0.12021666  0.081250284
## time_of_max_death_sd           0.162597212 -0.01455259  0.119636988
## max_death_sd                   0.067840413 -0.04108979 -0.039802724
## time_of_min_death_sd          -0.090368347  0.17279931  0.209633387
## min_death_sd                  -0.366394271 -0.09193303 -0.030070447
## end_point_death_sd             0.014502716 -0.02761868 -0.015380755
## time_of_max_rate_death_median -0.130990631  0.21755472 -0.205189172
## max_rate_death_median         -0.006819496  0.19028049 -0.066937195
## AUC_death_median              -0.072970987  0.05643030 -0.023352059
## time_of_max_death_median      -0.242085628 -0.06743804  0.332543380
## max_death_median              -0.105935171  0.16083607 -0.104511848
## time_of_min_death_median       0.084251204  0.09331355 -0.462212319
## min_death_median              -0.216340238 -0.44384409 -0.205907719
## end_point_death_median        -0.168296509  0.12253683 -0.045573133
## time_of_max_rate_death_mad    -0.072131365  0.10479022  0.064331983
## max_rate_death_mad             0.151315832 -0.04298384 -0.011605967
## AUC_death_mad                  0.106718644 -0.14740145  0.081137499
## time_of_max_death_mad          0.187725153 -0.16853984  0.120437029
## max_death_mad                  0.108695427 -0.08209946 -0.045891492
## time_of_min_death_mad         -0.121167746  0.20927085  0.191352771
## min_death_mad                 -0.336081037 -0.06249020 -0.089324218
## end_point_death_mad            0.036904728 -0.06263707 -0.026508173
## time_of_max_rate_death_IQR    -0.041760835  0.15870367  0.085417918
## max_rate_death_IQR             0.146433196 -0.06030714 -0.004627624
## AUC_death_IQR                  0.108505191 -0.13532369  0.070564128
## time_of_max_death_IQR          0.208844754 -0.02817015  0.126605609
## max_death_IQR                  0.113320840 -0.07407042 -0.045838566
## time_of_min_death_IQR         -0.109216027  0.22923159  0.231819852
## min_death_IQR                 -0.331322547 -0.08401138 -0.030968017
## end_point_death_IQR            0.053376118 -0.05448059 -0.017735521
##                                        PC7          PC8          PC9
## time_of_max_rate_death_mean    0.033946889 -0.261509551  0.132733468
## max_rate_death_mean            0.002865800  0.001788522 -0.013601161
## AUC_death_mean                -0.149547244 -0.002790903 -0.036587234
## time_of_max_death_mean         0.041162225 -0.056361322  0.090500048
## max_death_mean                -0.125224528 -0.089888801  0.023442807
## time_of_min_death_mean         0.027742412  0.008235619 -0.031481398
## min_death_mean                -0.213620914 -0.174463907 -0.262640037
## end_point_death_mean          -0.147563817 -0.152945804  0.052907636
## time_of_max_rate_death_sd     -0.389575758  0.197089237  0.042927265
## max_rate_death_sd              0.099623760  0.043818960 -0.012303116
## AUC_death_sd                  -0.021171755  0.077997777  0.043051918
## time_of_max_death_sd          -0.110761612 -0.296497761  0.241844066
## max_death_sd                   0.029699183  0.032551743  0.025198182
## time_of_min_death_sd           0.085416366 -0.131029550 -0.248207780
## min_death_sd                   0.180955036  0.092758829  0.205351895
## end_point_death_sd            -0.005710156 -0.056363484  0.068278558
## time_of_max_rate_death_median  0.047491159 -0.292397028  0.141700569
## max_rate_death_median         -0.001141974 -0.011313630 -0.020660841
## AUC_death_median              -0.141460551 -0.005349342 -0.035715227
## time_of_max_death_median       0.022229040 -0.122323406  0.119469135
## max_death_median              -0.122814306 -0.092982161  0.018890010
## time_of_min_death_median       0.025748781  0.012890884 -0.006750552
## min_death_median              -0.241426336 -0.211260579 -0.298424769
## end_point_death_median        -0.146981682 -0.161168068  0.056382813
## time_of_max_rate_death_mad    -0.394856643  0.272883659  0.030131109
## max_rate_death_mad             0.151482352  0.003357308 -0.100323938
## AUC_death_mad                 -0.023144284  0.087401619  0.003412077
## time_of_max_death_mad         -0.113539006 -0.297138725  0.265074737
## max_death_mad                  0.055167505  0.029849152 -0.044785134
## time_of_min_death_mad          0.115048153 -0.178956604 -0.372038938
## min_death_mad                  0.249577142  0.130454743  0.248620631
## end_point_death_mad            0.023579095 -0.054106548  0.003115916
## time_of_max_rate_death_IQR    -0.398394804  0.287910047  0.060859245
## max_rate_death_IQR             0.156356670  0.026219177 -0.055437226
## AUC_death_IQR                  0.014290329  0.094038974  0.019642564
## time_of_max_death_IQR         -0.140936560 -0.392951185  0.311385195
## max_death_IQR                  0.068972527  0.043984357 -0.017027564
## time_of_min_death_IQR          0.149772803 -0.140263527 -0.359151495
## min_death_IQR                  0.231333682  0.170569742  0.285031119
## end_point_death_IQR            0.042534975 -0.028975757  0.033313537
##                                       PC10          PC11         PC12
## time_of_max_rate_death_mean   -0.175567896  0.2317410356 -0.210982090
## max_rate_death_mean           -0.117625613  0.1011924220  0.102363112
## AUC_death_mean                 0.035496036 -0.0454487240  0.016444688
## time_of_max_death_mean        -0.211812337 -0.2320034952  0.068108551
## max_death_mean                 0.047940202 -0.0504138093 -0.023956022
## time_of_min_death_mean        -0.032036837 -0.3925392565  0.107054518
## min_death_mean                -0.032295776  0.0568341533  0.025470117
## end_point_death_mean           0.067918630 -0.1592815228 -0.053537802
## time_of_max_rate_death_sd     -0.056583719  0.0767994899  0.036692213
## max_rate_death_sd             -0.339687701  0.2261671421  0.160540068
## AUC_death_sd                   0.051083253 -0.1613215952 -0.288816034
## time_of_max_death_sd           0.087388558 -0.0800448414  0.344397671
## max_death_sd                   0.096972278  0.1753556068  0.025177848
## time_of_min_death_sd           0.106636502 -0.0653482301  0.025733863
## min_death_sd                   0.091866174  0.0794507017  0.037275789
## end_point_death_sd             0.236154542  0.2266617568  0.180952469
## time_of_max_rate_death_median -0.176986586  0.2311390195 -0.226117969
## max_rate_death_median         -0.099867110  0.0654658739  0.097400382
## AUC_death_median               0.026344241 -0.0488022506  0.031629916
## time_of_max_death_median      -0.217847068 -0.2886937412  0.245100349
## max_death_median               0.032401187 -0.0814653245 -0.023978023
## time_of_min_death_median      -0.063123839 -0.4068396819  0.084096194
## min_death_median              -0.119119408  0.0822031139  0.066852143
## end_point_death_median         0.058120951 -0.2019470232 -0.046794430
## time_of_max_rate_death_mad    -0.104771980  0.0917042653  0.023452837
## max_rate_death_mad            -0.426366061  0.0010361374  0.127966118
## AUC_death_mad                 -0.018487184 -0.2355789175 -0.299549021
## time_of_max_death_mad         -0.127912605  0.0820290669 -0.447693081
## max_death_mad                  0.070692775  0.0131185240  0.020549367
## time_of_min_death_mad          0.021727830 -0.0149265285 -0.087664167
## min_death_mad                 -0.046264202 -0.0124353785  0.038372524
## end_point_death_mad            0.279745640  0.0940367725  0.198930198
## time_of_max_rate_death_IQR    -0.155688158  0.0323832883  0.040635404
## max_rate_death_IQR            -0.408986364 -0.0019197714  0.134801119
## AUC_death_IQR                  0.019354137 -0.2328512361 -0.281670442
## time_of_max_death_IQR          0.008371766 -0.0887259500  0.208324206
## max_death_IQR                  0.101463301 -0.0008368758 -0.006270885
## time_of_min_death_IQR          0.052776548 -0.0421996878 -0.061151278
## min_death_IQR                  0.048581631 -0.0053818523 -0.031943809
## end_point_death_IQR            0.267647653  0.0680444785  0.142770312
##                                       PC13         PC14         PC15
## time_of_max_rate_death_mean    0.120964692 -0.121581988  0.012771883
## max_rate_death_mean            0.011630347  0.035894277 -0.059004795
## AUC_death_mean                 0.026251459 -0.011518499 -0.014217422
## time_of_max_death_mean        -0.170913656  0.078875351 -0.048138789
## max_death_mean                 0.011075756  0.048459650 -0.015778186
## time_of_min_death_mean        -0.112469182  0.136061626 -0.162894201
## min_death_mean                 0.043252145 -0.052417064 -0.153663055
## end_point_death_mean          -0.023057487  0.094510920 -0.011954200
## time_of_max_rate_death_sd     -0.064993349  0.120929044  0.154050778
## max_rate_death_sd              0.125558383  0.481697470 -0.164594572
## AUC_death_sd                   0.344890132  0.164906138 -0.025330256
## time_of_max_death_sd           0.274416917  0.004540115  0.062207694
## max_death_sd                   0.043664599  0.344276007 -0.099528019
## time_of_min_death_sd           0.028676245 -0.093864093 -0.645982740
## min_death_sd                  -0.043573209 -0.069506060 -0.188980287
## end_point_death_sd             0.003045134  0.311943442 -0.037380543
## time_of_max_rate_death_median  0.202631648 -0.172570853 -0.030488219
## max_rate_death_median         -0.019809785 -0.072737483 -0.038290933
## AUC_death_median              -0.013468986 -0.045777661  0.009027216
## time_of_max_death_median      -0.032249897  0.053828220 -0.057285091
## max_death_median              -0.021884004 -0.039112764  0.016072380
## time_of_min_death_median      -0.158317861  0.169527879  0.014130270
## min_death_median               0.062450893  0.033814632  0.140539324
## end_point_death_median        -0.045559593  0.007217717  0.027268915
## time_of_max_rate_death_mad    -0.074868969 -0.194756263 -0.104281789
## max_rate_death_mad            -0.073847254 -0.243987934  0.004471605
## AUC_death_mad                  0.213755511 -0.104983042  0.036902376
## time_of_max_death_mad         -0.607509364  0.199692798 -0.099911743
## max_death_mad                 -0.214581309 -0.210900849  0.014021900
## time_of_min_death_mad         -0.085236374  0.112880267  0.309017721
## min_death_mad                 -0.006720426  0.111996232  0.423454852
## end_point_death_mad           -0.247850466 -0.235459145  0.069969137
## time_of_max_rate_death_IQR    -0.050622220 -0.029297649  0.038593876
## max_rate_death_IQR            -0.042290531 -0.185043847  0.070277102
## AUC_death_IQR                  0.221411188 -0.079513359  0.028448535
## time_of_max_death_IQR          0.130395633 -0.137206675  0.095043826
## max_death_IQR                 -0.113001388 -0.099418008  0.025841833
## time_of_min_death_IQR         -0.071309057  0.070644200  0.229489335
## min_death_IQR                 -0.031982661 -0.102949287 -0.138860924
## end_point_death_IQR           -0.131253181 -0.104273490  0.076922211
##                                        PC16         PC17         PC18
## time_of_max_rate_death_mean    0.0221793320 -0.054432067 -0.044501908
## max_rate_death_mean           -0.0436558205  0.094365707 -0.428912949
## AUC_death_mean                -0.0446564033 -0.003978987 -0.073145452
## time_of_max_death_mean        -0.0041175265  0.038820799 -0.075167606
## max_death_mean                 0.0244629134 -0.019610333  0.073343268
## time_of_min_death_mean         0.0003674721  0.012583370 -0.061559954
## min_death_mean                -0.1468636778 -0.060374152 -0.049543211
## end_point_death_mean           0.0557703358 -0.045989437  0.322172201
## time_of_max_rate_death_sd      0.1850793883 -0.486627369 -0.022145423
## max_rate_death_sd             -0.0792267800  0.019508977  0.156745278
## AUC_death_sd                  -0.0183061356  0.046667670 -0.116990020
## time_of_max_death_sd           0.0283039945  0.212537875  0.133661934
## max_death_sd                  -0.0034129020  0.026454739  0.086965782
## time_of_min_death_sd           0.4971801830 -0.045977526 -0.042176847
## min_death_sd                  -0.4173100903 -0.113379770  0.126198216
## end_point_death_sd            -0.0413532653  0.037322427 -0.083888644
## time_of_max_rate_death_median -0.0232411131  0.055089875 -0.067968295
## max_rate_death_median         -0.0318785545  0.085833810 -0.452329908
## AUC_death_median              -0.0468397223 -0.006888938 -0.052575168
## time_of_max_death_median      -0.0812489391  0.073268633 -0.221609478
## max_death_median               0.0285451485 -0.012798125  0.079158544
## time_of_min_death_median      -0.1353793263  0.042405465 -0.084072098
## min_death_median               0.1741313532  0.056323722 -0.080108695
## end_point_death_median         0.0656729770 -0.040127910  0.326847426
## time_of_max_rate_death_mad    -0.1079896707  0.678885958  0.187463946
## max_rate_death_mad             0.0323312695 -0.084827494  0.186905966
## AUC_death_mad                 -0.0393532407  0.023357330 -0.131970134
## time_of_max_death_mad          0.0454253527  0.087447369 -0.086240260
## max_death_mad                  0.0220473214  0.008508649  0.103487719
## time_of_min_death_mad         -0.2552514808  0.043510756 -0.011278943
## min_death_mad                  0.5449581885  0.222342291 -0.050879187
## end_point_death_mad           -0.0027252104  0.048869723 -0.108760017
## time_of_max_rate_death_IQR    -0.0355617877 -0.224266037 -0.149987245
## max_rate_death_IQR             0.0526793588 -0.115848951  0.160395581
## AUC_death_IQR                 -0.0125708549  0.019058011 -0.084830289
## time_of_max_death_IQR         -0.1107895251 -0.189564064 -0.053176161
## max_death_IQR                  0.0739842195 -0.046528781  0.042462414
## time_of_min_death_IQR         -0.1418983327  0.025424049  0.039545780
## min_death_IQR                 -0.1355185822 -0.149772850  0.001475749
## end_point_death_IQR            0.0454721551 -0.028694538 -0.170995625
##                                       PC19         PC20          PC21
## time_of_max_rate_death_mean    0.058841002  0.001727072 -0.0402075362
## max_rate_death_mean            0.008071747  0.050804554 -0.0452613030
## AUC_death_mean                 0.050041434  0.003983032  0.0219316585
## time_of_max_death_mean        -0.013962578  0.073609572 -0.0571718560
## max_death_mean                -0.012892587 -0.009104188  0.0315750583
## time_of_min_death_mean        -0.009947744  0.026909072 -0.0061552456
## min_death_mean                 0.082494864 -0.072239802 -0.0079248493
## end_point_death_mean          -0.020066725 -0.044617059  0.0542264180
## time_of_max_rate_death_sd      0.117430468  0.451457679 -0.2655219804
## max_rate_death_sd             -0.090231749 -0.158625866 -0.0716688963
## AUC_death_sd                  -0.039342550  0.170596972  0.1564596363
## time_of_max_death_sd           0.628182030  0.007562816  0.0211472721
## max_death_sd                  -0.066837115 -0.046528650 -0.1148018758
## time_of_min_death_sd          -0.082703364  0.010319586  0.0326383777
## min_death_sd                  -0.023620411  0.453070450  0.2752149603
## end_point_death_sd            -0.019861251  0.031791496 -0.0426848185
## time_of_max_rate_death_median  0.062179936  0.005445942  0.0323710676
## max_rate_death_median          0.037511808  0.105957415 -0.0587750324
## AUC_death_median               0.065296267 -0.030323734 -0.0341748269
## time_of_max_death_median       0.052162046 -0.011151388  0.0076532890
## max_death_median              -0.010204275 -0.016069894 -0.0295837576
## time_of_min_death_median      -0.007209128  0.039628259 -0.0050495221
## min_death_median              -0.084523485 -0.026323618  0.0261418818
## end_point_death_median        -0.025047031 -0.071439387 -0.0002688162
## time_of_max_rate_death_mad    -0.219145945  0.091590791 -0.0471976861
## max_rate_death_mad             0.079278263  0.128638674 -0.0822819578
## AUC_death_mad                  0.022111639  0.019115072 -0.3338717802
## time_of_max_death_mad          0.123080814  0.014443186  0.0752035192
## max_death_mad                  0.036946800 -0.068266699 -0.3339364574
## time_of_min_death_mad         -0.021969244 -0.068116234 -0.0485398369
## min_death_mad                 -0.122119850  0.009382242  0.0427294123
## end_point_death_mad            0.056159664  0.021160370 -0.1980947158
## time_of_max_rate_death_IQR     0.084689474 -0.488935794  0.3347471195
## max_rate_death_IQR             0.008861928  0.039331886  0.2489316082
## AUC_death_IQR                  0.044530610 -0.025319707  0.1174300035
## time_of_max_death_IQR         -0.654006344 -0.052108761 -0.0784736046
## max_death_IQR                 -0.012020196 -0.045201806  0.2638714985
## time_of_min_death_IQR          0.019763127 -0.030911852  0.0333701718
## min_death_IQR                  0.087478154 -0.462582763 -0.3091955660
## end_point_death_IQR           -0.027471627 -0.032529770  0.3840361264
##                                       PC22         PC23         PC24
## time_of_max_rate_death_mean   -0.011542855 -0.004073764 -0.020548654
## max_rate_death_mean            0.007522624  0.012903822 -0.146262545
## AUC_death_mean                -0.041448161  0.080741272 -0.033138096
## time_of_max_death_mean        -0.065248050  0.023345867  0.012934700
## max_death_mean                -0.018500075 -0.004123927 -0.022019571
## time_of_min_death_mean        -0.027973574  0.028401367 -0.002531384
## min_death_mean                -0.122419159 -0.027194872  0.003963424
## end_point_death_mean          -0.025329358 -0.084565563  0.015277516
## time_of_max_rate_death_sd     -0.186859530 -0.042449515 -0.222608053
## max_rate_death_sd              0.203314248 -0.095268489 -0.302238261
## AUC_death_sd                  -0.238504433 -0.027785568  0.202307622
## time_of_max_death_sd           0.019721118  0.037070037 -0.058319499
## max_death_sd                  -0.059271429  0.305486740  0.087376208
## time_of_min_death_sd           0.096176120 -0.072119708  0.011170545
## min_death_sd                   0.352563804  0.100968954  0.040834319
## end_point_death_sd            -0.088561937 -0.165353990  0.402812175
## time_of_max_rate_death_median  0.011006253  0.068201314 -0.036005543
## max_rate_death_median         -0.061681566  0.072056358  0.038119143
## AUC_death_median               0.009418042  0.089236597 -0.006278153
## time_of_max_death_median       0.024904353  0.101630211 -0.078211965
## max_death_median               0.046853950  0.002230741  0.024563267
## time_of_min_death_median      -0.007970242 -0.036940561  0.017249453
## min_death_median               0.069572303  0.072875765 -0.019500799
## end_point_death_median         0.064294704 -0.096852214  0.024344530
## time_of_max_rate_death_mad    -0.186948715 -0.061363243 -0.073238890
## max_rate_death_mad            -0.179150732 -0.063266991  0.522009289
## AUC_death_mad                  0.341704298 -0.113523758  0.068999199
## time_of_max_death_mad         -0.004634259 -0.021857419  0.028953891
## max_death_mad                  0.240433093  0.380820578 -0.136634452
## time_of_min_death_mad          0.117191248 -0.416345699 -0.128215745
## min_death_mad                  0.135384316  0.032578883  0.075446219
## end_point_death_mad            0.193553602 -0.216865935  0.076084218
## time_of_max_rate_death_IQR     0.305391470  0.083880311  0.284093339
## max_rate_death_IQR            -0.070357752 -0.162602760 -0.154553621
## AUC_death_IQR                 -0.009988343 -0.018872071 -0.188953191
## time_of_max_death_IQR         -0.032838328  0.075018455  0.007836719
## max_death_IQR                 -0.138941802  0.277398001 -0.302630842
## time_of_min_death_IQR         -0.215424503  0.465257219  0.125288972
## min_death_IQR                 -0.410270414 -0.117332552 -0.081781310
## end_point_death_IQR           -0.195428062 -0.237746597 -0.155259470
##                                       PC25         PC26         PC27
## time_of_max_rate_death_mean   -0.056738766  0.018395143  0.016296758
## max_rate_death_mean           -0.017068529 -0.180916382  0.077754247
## AUC_death_mean                 0.064349249  0.475236198 -0.206291266
## time_of_max_death_mean        -0.044996500 -0.071559085  0.029872281
## max_death_mean                 0.003121046 -0.087897915  0.011660081
## time_of_min_death_mean        -0.055695434  0.048832556 -0.071880051
## min_death_mean                 0.055146790  0.150725066 -0.053090621
## end_point_death_mean          -0.025481157 -0.089112918  0.052235831
## time_of_max_rate_death_sd     -0.024577099  0.007590524 -0.002938451
## max_rate_death_sd             -0.275919348  0.178475752  0.212561703
## AUC_death_sd                   0.191027139  0.227775117  0.477127347
## time_of_max_death_sd           0.043000728 -0.093494569  0.036435333
## max_death_sd                   0.281779384 -0.124643021 -0.121942436
## time_of_min_death_sd           0.043410146  0.018991646 -0.020323649
## min_death_sd                  -0.014462746 -0.094020769  0.015436744
## end_point_death_sd            -0.034993188 -0.096464016 -0.396218338
## time_of_max_rate_death_median  0.036991989  0.176764274 -0.079185208
## max_rate_death_median          0.042706089 -0.291131442  0.110482666
## AUC_death_median               0.057560186  0.429662219 -0.210169382
## time_of_max_death_median       0.115653406  0.100500283 -0.065493097
## max_death_median              -0.023663582 -0.144751053  0.033104074
## time_of_min_death_median       0.018178294  0.043186655  0.035024935
## min_death_median              -0.082680299 -0.262375800  0.095395476
## end_point_death_median        -0.073850001 -0.131383798  0.092385472
## time_of_max_rate_death_mad    -0.023421117 -0.019522343 -0.048323796
## max_rate_death_mad             0.095367566 -0.021346753  0.121615868
## AUC_death_mad                 -0.170977970 -0.112761155 -0.382935275
## time_of_max_death_mad         -0.023697683  0.021924008 -0.014289190
## max_death_mad                  0.239104053  0.026372992  0.210826430
## time_of_min_death_mad          0.468734719 -0.042342903  0.007759472
## min_death_mad                  0.052955612  0.140304566 -0.040082728
## end_point_death_mad           -0.253356967  0.262237465  0.282678516
## time_of_max_rate_death_IQR     0.042099488 -0.029494297  0.076765428
## max_rate_death_IQR            -0.025707278  0.013070140 -0.295288649
## AUC_death_IQR                 -0.193772949 -0.145879467  0.002617204
## time_of_max_death_IQR          0.026596455  0.021501727  0.005933462
## max_death_IQR                  0.249635810 -0.102343677 -0.141364498
## time_of_min_death_IQR         -0.489962027  0.036216559 -0.020798768
## min_death_IQR                 -0.018308041 -0.097115394  0.025977982
## end_point_death_IQR           -0.161078978  0.002324754  0.040037355
##                                       PC28         PC29          PC30
## time_of_max_rate_death_mean    0.037849461  0.012004900  0.0040906277
## max_rate_death_mean            0.155109034 -0.051008242  0.0757320684
## AUC_death_mean                -0.167893399 -0.089323026  0.1032213960
## time_of_max_death_mean         0.036518646 -0.607594071  0.3005896098
## max_death_mean                 0.168711484  0.132230703 -0.0605565084
## time_of_min_death_mean        -0.013534904  0.004687606  0.0447053202
## min_death_mean                 0.568591258 -0.127285736 -0.2558131323
## end_point_death_mean           0.108021135 -0.028765056  0.0691356812
## time_of_max_rate_death_sd     -0.016928180  0.025569763 -0.0652089312
## max_rate_death_sd             -0.038494704 -0.067104853 -0.1366686876
## AUC_death_sd                   0.075398276  0.169731203  0.2877767802
## time_of_max_death_sd           0.014110387 -0.095011204  0.0749598718
## max_death_sd                  -0.006603142  0.020755014  0.0404324625
## time_of_min_death_sd          -0.044238899 -0.014959045  0.0137479407
## min_death_sd                  -0.087859214 -0.002428350  0.0143746057
## end_point_death_sd            -0.034725334 -0.014546283 -0.0003364042
## time_of_max_rate_death_median -0.110822215 -0.063685017  0.0110285049
## max_rate_death_median          0.055946783 -0.059020830  0.0004911207
## AUC_death_median              -0.316762117 -0.146501111 -0.0088682629
## time_of_max_death_median      -0.068170503  0.532108929 -0.2767892529
## max_death_median               0.015802849  0.165418726 -0.1530355884
## time_of_min_death_median      -0.040927147 -0.031395231 -0.0030752642
## min_death_median              -0.487274312  0.123281597  0.2396541509
## end_point_death_median        -0.018201557 -0.002950375  0.0028174100
## time_of_max_rate_death_mad    -0.001619239  0.026404330 -0.0118421301
## max_rate_death_mad            -0.178028701 -0.098783785 -0.3287489808
## AUC_death_mad                  0.095387173  0.086473277  0.0974728652
## time_of_max_death_mad         -0.021969505  0.082475558 -0.0208492317
## max_death_mad                  0.057738289  0.031550768  0.0419344977
## time_of_min_death_mad         -0.067962461 -0.076674028 -0.0275905568
## min_death_mad                  0.177666311 -0.065848103 -0.1424967486
## end_point_death_mad            0.055844358  0.036290066  0.1258770064
## time_of_max_rate_death_IQR     0.048696080 -0.054524527  0.0516815312
## max_rate_death_IQR             0.209088542  0.221871419  0.4406624391
## AUC_death_IQR                 -0.173171984 -0.245823543 -0.3955643571
## time_of_max_death_IQR          0.037196724 -0.086772819 -0.0124567048
## max_death_IQR                  0.004879219 -0.126687091 -0.0454846567
## time_of_min_death_IQR          0.092722157  0.069891627  0.0393023273
## min_death_IQR                 -0.152599481  0.084831636  0.1209132975
## end_point_death_IQR           -0.097076815  0.021314863 -0.1331824027
##                                       PC31         PC32          PC33
## time_of_max_rate_death_mean    0.079414933 -0.688148248 -9.594581e-02
## max_rate_death_mean           -0.028197474  0.061079067 -5.411537e-03
## AUC_death_mean                 0.097529442  0.001951392  4.496633e-03
## time_of_max_death_mean         0.040128917 -0.035875886  4.525868e-02
## max_death_mean                -0.003165659  0.063291417  1.914254e-03
## time_of_min_death_mean         0.056746534 -0.147139683 -6.493188e-02
## min_death_mean                -0.007764627  0.012946363 -3.272146e-05
## end_point_death_mean           0.043602573  0.108528978 -1.817080e-02
## time_of_max_rate_death_sd     -0.012866520  0.080523309  1.028519e-02
## max_rate_death_sd              0.150714635  0.007544346  7.539661e-02
## AUC_death_sd                   0.019994516 -0.053198738  1.038253e-01
## time_of_max_death_sd           0.052381661 -0.021875717  1.024279e-03
## max_death_sd                  -0.057099783  0.054109432 -5.196910e-01
## time_of_min_death_sd          -0.034486740  0.009207270  2.076721e-02
## min_death_sd                   0.020521526 -0.025834897 -9.786625e-03
## end_point_death_sd            -0.231508155 -0.069670851  3.916844e-01
## time_of_max_rate_death_median -0.060722858  0.605428576  8.733535e-02
## max_rate_death_median          0.023469539 -0.004401945 -3.555609e-02
## AUC_death_median              -0.064316119 -0.208665808 -2.414667e-02
## time_of_max_death_median      -0.037609284 -0.006022739 -5.266826e-02
## max_death_median              -0.071869925 -0.075568993  1.129944e-01
## time_of_min_death_median      -0.060991805  0.145380133  6.488236e-02
## min_death_median               0.002766089  0.007853343 -2.652974e-03
## end_point_death_median         0.018522442  0.020269197 -5.305154e-02
## time_of_max_rate_death_mad     0.014508008 -0.034772681  1.976762e-04
## max_rate_death_mad             0.179243464  0.050927756 -6.676968e-02
## AUC_death_mad                  0.428602840  0.070677441 -5.353625e-02
## time_of_max_death_mad         -0.011415936  0.016404455 -7.141926e-03
## max_death_mad                 -0.069828702 -0.069986981  5.232611e-01
## time_of_min_death_mad         -0.013536182 -0.030560248 -2.798672e-02
## min_death_mad                 -0.001117137  0.002732167 -8.646295e-05
## end_point_death_mad           -0.216946715  0.075813403 -4.215702e-01
## time_of_max_rate_death_IQR    -0.013859768  0.014923871 -1.110330e-02
## max_rate_death_IQR            -0.311441175 -0.025480708  1.440487e-02
## AUC_death_IQR                 -0.534121322 -0.058590345 -4.052511e-02
## time_of_max_death_IQR         -0.016033202 -0.006075826 -6.545393e-03
## max_death_IQR                  0.210104335  0.010545070 -1.532884e-01
## time_of_min_death_IQR          0.022720750  0.031790775  1.777783e-02
## min_death_IQR                  0.001955111  0.038814008  7.535220e-03
## end_point_death_IQR            0.421162743  0.018995408  1.610498e-01
##                                       PC34          PC35          PC36
## time_of_max_rate_death_mean   -0.023287200  0.1693260327  0.1057240334
## max_rate_death_mean           -0.140213518  0.1685046122  0.0241009410
## AUC_death_mean                -0.150743906  0.2234727449  0.0751943179
## time_of_max_death_mean        -0.067295359 -0.2000516666  0.1420639109
## max_death_mean                -0.499470575 -0.0983062907  0.2674856215
## time_of_min_death_mean        -0.153503105 -0.2756203142 -0.4438178283
## min_death_mean                 0.120893622 -0.0285242289 -0.0163912072
## end_point_death_mean          -0.163938234  0.4420886501 -0.1163611377
## time_of_max_rate_death_sd      0.028273106 -0.0066110552 -0.0216982506
## max_rate_death_sd             -0.005539877 -0.0481740817 -0.0808698245
## AUC_death_sd                   0.013808898 -0.0792933970 -0.0769051583
## time_of_max_death_sd          -0.012351155 -0.0310870700  0.0492525211
## max_death_sd                   0.214340157 -0.0658262050  0.2939687503
## time_of_min_death_sd           0.031572237  0.0480525408  0.1089590689
## min_death_sd                  -0.011272498  0.0144702172  0.0061866963
## end_point_death_sd            -0.077538420  0.0671427038 -0.1834184623
## time_of_max_rate_death_median  0.040445585 -0.1408598248 -0.1005673130
## max_rate_death_median          0.303754557  0.0480744615 -0.2187152289
## AUC_death_median               0.202496538 -0.1459102061  0.0007758957
## time_of_max_death_median      -0.002556528  0.1007151547 -0.0662883669
## max_death_median              -0.034602349 -0.6330740799  0.1892291639
## time_of_min_death_median       0.143662974  0.2536774686  0.4303869317
## min_death_median              -0.108504849  0.0280508269  0.0060197125
## end_point_death_median         0.515555986  0.0644569643 -0.2569816811
## time_of_max_rate_death_mad     0.004014843  0.0126228608  0.0055120579
## max_rate_death_mad            -0.121131267  0.0497168937  0.0127180664
## AUC_death_mad                  0.009828957 -0.0023776610  0.0335415493
## time_of_max_death_mad         -0.002841134 -0.0071683283 -0.0123838200
## max_death_mad                  0.050417033  0.0841483475  0.0376926905
## time_of_min_death_mad         -0.042665310 -0.0503887320 -0.0406793208
## min_death_mad                  0.023244693  0.0055861657 -0.0158854395
## end_point_death_mad           -0.131433498 -0.0281414070 -0.0831779731
## time_of_max_rate_death_IQR    -0.016448391 -0.0026294188 -0.0033347817
## max_rate_death_IQR             0.123647814 -0.0400533585  0.0647009523
## AUC_death_IQR                 -0.043479459  0.0922644623  0.0256234742
## time_of_max_death_IQR         -0.016618319  0.0011373207  0.0050304508
## max_death_IQR                 -0.225161230  0.0046522603 -0.3178592180
## time_of_min_death_IQR          0.023362539  0.0116856556  0.0073927475
## min_death_IQR                 -0.036715736 -0.0009321717 -0.0042421439
## end_point_death_IQR            0.205327442 -0.0550580913  0.2561014125
##                                        PC37          PC38          PC39
## time_of_max_rate_death_mean    0.0540945981  0.0338978334  0.0340787702
## max_rate_death_mean           -0.0532900278 -0.5596688956  0.3681031004
## AUC_death_mean                -0.1391543908  0.4738615259  0.4189555221
## time_of_max_death_mean        -0.0090855722  0.0388123963  0.0085017307
## max_death_mean                -0.0709516346  0.0289261211 -0.1205911217
## time_of_min_death_mean        -0.4236938175 -0.0285760530  0.0279181821
## min_death_mean                 0.0010515061 -0.0129087593 -0.0009723057
## end_point_death_mean          -0.1577587196 -0.0512012882 -0.4221387798
## time_of_max_rate_death_sd      0.0033637164 -0.0087751400  0.0008053795
## max_rate_death_sd              0.1110739672  0.0955825430 -0.0616079717
## AUC_death_sd                   0.0874703690 -0.0511486542 -0.0027469757
## time_of_max_death_sd           0.0093861079  0.0035574200  0.0044047402
## max_death_sd                  -0.2663779816 -0.0043098757  0.0162303510
## time_of_min_death_sd           0.0884580658  0.0080765030 -0.0064849778
## min_death_sd                  -0.0209692334 -0.0087083703  0.0067598780
## end_point_death_sd             0.1422622732  0.0049940891  0.0519387977
## time_of_max_rate_death_median -0.0552695157 -0.0287466917 -0.0345446889
## max_rate_death_median          0.0149448016  0.4600465100 -0.3440950804
## AUC_death_median               0.0972138093 -0.4331694927 -0.4069395910
## time_of_max_death_median       0.0134753795 -0.0150621530 -0.0060972550
## max_death_median               0.2067296524  0.1317877971  0.0926822585
## time_of_min_death_median       0.3863420431  0.0314602234 -0.0310394360
## min_death_median               0.0030224916  0.0025288892  0.0008254243
## end_point_death_median         0.0708062188 -0.0802558777  0.4234968447
## time_of_max_rate_death_mad     0.0059621601 -0.0017058270 -0.0033047297
## max_rate_death_mad            -0.0344291018 -0.0762807878  0.0691325641
## AUC_death_mad                  0.0528212978 -0.0268821249 -0.0497409287
## time_of_max_death_mad         -0.0116547874  0.0001658293  0.0058260334
## max_death_mad                 -0.1990136870 -0.0057085768 -0.0094771655
## time_of_min_death_mad         -0.0622222218  0.0267193413  0.0057894990
## min_death_mad                 -0.0225064219  0.0049299001 -0.0067283428
## end_point_death_mad            0.1218121826  0.0452101759 -0.0145702928
## time_of_max_rate_death_IQR    -0.0123210606  0.0021773454  0.0029611170
## max_rate_death_IQR            -0.0600506608  0.0363720707 -0.0398507021
## AUC_death_IQR                 -0.1489980892  0.0643411095  0.0304834242
## time_of_max_death_IQR         -0.0008726665  0.0021910783 -0.0051197944
## max_death_IQR                  0.5022169226 -0.0027631282  0.0355811195
## time_of_min_death_IQR          0.0252713753 -0.0239348599  0.0026637024
## min_death_IQR                  0.0339194783  0.0088943829  0.0041021714
## end_point_death_IQR           -0.3048439610 -0.0497448339 -0.0411108282
##                                        PC40
## time_of_max_rate_death_mean    8.520697e-03
## max_rate_death_mean            1.693026e-01
## AUC_death_mean                 1.131375e-01
## time_of_max_death_mean        -2.740423e-02
## max_death_mean                -6.485005e-01
## time_of_min_death_mean         1.391555e-03
## min_death_mean                 1.524987e-02
## end_point_death_mean           4.345450e-01
## time_of_max_rate_death_sd      1.418083e-03
## max_rate_death_sd             -2.151993e-02
## AUC_death_sd                  -9.109959e-03
## time_of_max_death_sd           1.961964e-04
## max_death_sd                   5.159814e-02
## time_of_min_death_sd          -2.870632e-03
## min_death_sd                  -2.491765e-04
## end_point_death_sd            -3.422495e-02
## time_of_max_rate_death_median -4.179036e-03
## max_rate_death_median         -1.048089e-01
## AUC_death_median              -1.080910e-01
## time_of_max_death_median       6.609838e-03
## max_death_median               4.754869e-01
## time_of_min_death_median       1.625693e-04
## min_death_median              -1.237929e-02
## end_point_death_median        -3.053392e-01
## time_of_max_rate_death_mad    -4.168889e-03
## max_rate_death_mad             7.050883e-03
## AUC_death_mad                  2.570724e-03
## time_of_max_death_mad         -4.025323e-03
## max_death_mad                 -2.974680e-02
## time_of_min_death_mad         -4.158515e-03
## min_death_mad                  7.453608e-03
## end_point_death_mad            1.600800e-02
## time_of_max_rate_death_IQR     4.810499e-03
## max_rate_death_IQR            -6.523592e-03
## AUC_death_IQR                  7.130133e-05
## time_of_max_death_IQR          2.427715e-03
## max_death_IQR                 -1.442552e-03
## time_of_min_death_IQR          2.080028e-03
## min_death_IQR                 -4.061409e-03
## end_point_death_IQR            1.023935e-02
## 
## $prefix
## [1] "PC"
## 
## $keep_original_cols
## [1] FALSE
## 
## $skip
## [1] FALSE
## 
## $id
## [1] "pca_62aqr"
## 
## attr(,"class")
## [1] "step_pca" "step"
tidied_pca <- tidy(pi_pca_estimates, 3)

tidied_pca %>%
  filter(component %in% c("PC1", "PC2")) %>%
  mutate(component = fct_inorder(component)) %>%
  ggplot(aes(value, terms, fill = terms)) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~component) +
  labs(y = NULL)

Not sure that this approach is the best. We can simply reproduce what Romain did

df_pca <- PI_parameters %>%
  column_to_rownames("sample_id")
pca1 <- dudi.pca(df = df_pca, scannf = F, nf = 5, scale = T)

% variance explained

fviz_screeplot(pca1, addlabels = T)

fviz_contrib(pca1, choice = "var", axes = 1:5) +
  coord_flip()

Try with mean only

df_pca <- PI_parameters %>%
  select(ends_with("mean"), sample_id) %>%
  select(-contains("doubling")) %>%
  column_to_rownames("sample_id")
pca2 <- dudi.pca(df = df_pca, scannf = F, nf = 5, scale = T)
fviz_screeplot(pca2, addlabels = T)

fviz_contrib(pca2, choice = "var", axes = 1)

fviz_contrib(pca2, choice = "var", axes = 2)

Unsupervised random forest

# df_rf <- PI_parameters %>%
#   select(sample_id, ends_with("mean"), ends_with("sd")) 

df_rf <- PI_parameters %>%
  select(sample_id, ends_with("mean"))

rf_preproc <- preProcess(df_rf, method = c("zv"))

df_rf <- predict(rf_preproc, df_rf)

set.seed(1234)

rf1 <- randomForest(x = df_rf[,-1], ntree = 500, proximity = TRUE, importance = TRUE)

rf1
## 
## Call:
##  randomForest(x = df_rf[, -1], ntree = 500, importance = TRUE,      proximity = TRUE) 
##                Type of random forest: unsupervised
##                      Number of trees: 500
## No. of variables tried at each split: 2
varImpPlot(rf1)

rf1$importanceSD
##                                       1           2 MeanDecreaseAccuracy
## time_of_max_rate_death_mean 0.002541293 0.001300150         0.0014385960
## max_rate_death_mean         0.003397960 0.001384438         0.0018555287
## AUC_death_mean              0.003972547 0.001383825         0.0020658735
## time_of_max_death_mean      0.002415702 0.001154560         0.0013492331
## max_death_mean              0.004380443 0.001379188         0.0023530430
## time_of_min_death_mean      0.002413917 0.001244941         0.0013462442
## min_death_mean              0.001243925 0.001006915         0.0008200453
## end_point_death_mean        0.003955120 0.001376400         0.0021323777
df_importance <- rf1$importance %>%
  as.data.frame() %>%
  rownames_to_column("Variable") %>%
  as_tibble() %>%
  pivot_longer(cols = contains("Mean"), names_to = "importance_type", values_to = "importance") %>%
  mutate(parameter = str_match(Variable, "(.*)_death_(mean|sd)")[,2],
         statistic = str_match(Variable, "(.*)_death_(mean|sd)")[,3]) %>%
  mutate(parameter_long = fct_recode(parameter,
    `PI uptake AUC` = "AUC",
    `Maximum PI uptake rate` = "max_rate",
    `Peak PI uptake` = "max",
    `Time of peak PI uptake` = "time_of_max",
    `Time of maximum PI uptake rate` = "time_of_max_rate",
    `Trough PI uptake`= "min",
    `Time of through PI uptake` = "time_of_min"
  )) %>%
  mutate(parameter_short = fct_recode(parameter,
    `AUC` = "AUC",
    `Maximum rate` = "max_rate",
    `Peak` = "max",
    `Time of peak` = "time_of_max",
    `Time of maximum rate` = "time_of_max_rate",
    `Trough`= "min",
    `Time of through` = "time_of_min",
    `Final uptake` = "end_point"
  )) %>%
  mutate(label = str_c(parameter_short, " (", statistic, ")"))



p1 <- df_importance %>%
  filter(importance_type == "MeanDecreaseGini") %>%
  ggplot(aes(x = fct_reorder(parameter_short, importance), y = importance, fill = statistic)) +
geom_bar(stat = "identity", width = .7, position = "dodge") +
  coord_flip() +
  labs(x = "", y = "Importance") +
  theme_bw()

p2 <- df_importance %>%
  pivot_wider(names_from = "importance_type", values_from = "importance") %>%
  ggplot(aes(x =MeanDecreaseGini, y = MeanDecreaseAccuracy)) +
geom_point(size = 3) +
  geom_text_repel(aes(label = parameter_short)) +
  theme_bw()
  theme(text = element_text(face = "bold"))
## List of 1
##  $ text:List of 11
##   ..$ family       : NULL
##   ..$ face         : chr "bold"
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       : NULL
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi FALSE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  - attr(*, "class")= chr [1:2] "theme" "gg"
##  - attr(*, "complete")= logi FALSE
##  - attr(*, "validate")= logi TRUE
prox <- rf1$proximity
pam.rf <- pam(prox, 3)
pred <- cbind(pam.rf$clustering, PI_parameters$sample_id)
table(pred[,2], pred[,1])
##      
##       1 2 3
##   7   1 0 0
##   8   0 1 0
##   9   0 1 0
##   10  0 0 1
##   11  0 0 1
##   12  1 0 0
##   13  0 0 1
##   14  0 0 1
##   15  0 0 1
##   16  0 0 1
##   17  0 1 0
##   18  0 1 0
##   19  0 0 1
##   20  0 0 1
##   21  0 0 1
##   22  0 0 1
##   23  1 0 0
##   24  0 0 1
##   25  0 0 1
##   26  0 0 1
##   27  0 1 0
##   28  0 0 1
##   29  0 1 0
##   30  0 1 0
##   31  0 1 0
##   32  0 0 1
##   33  0 1 0
##   34  0 1 0
##   35  1 0 0
##   36  0 1 0
##   37  1 0 0
##   38  0 1 0
##   39  1 0 0
##   40  1 0 0
##   41  0 1 0
##   42  0 1 0
##   43  0 0 1
##   44  0 1 0
##   45  0 1 0
##   46  0 1 0
##   47  0 0 1
##   48  0 0 1
##   49  0 1 0
##   50  1 0 0
##   51  1 0 0
##   52  0 0 1
##   53  1 0 0
##   54  0 0 1
##   55  0 0 1
##   56  1 0 0
##   57  1 0 0
##   58  0 0 1
##   59  0 0 1
##   60  0 0 1
##   61  1 0 0
##   62  1 0 0
##   63  0 0 1
##   64  0 0 1
##   65  0 0 1
##   66  1 0 0
##   67  0 0 1
##   68  0 0 1
##   69  0 0 1
##   70  0 1 0
##   71  1 0 0
##   72  0 1 0
##   73  0 0 1
##   74  1 0 0
##   75  1 0 0
##   76  0 0 1
##   77  0 0 1
##   78  0 0 1
##   79  0 0 1
##   80  0 1 0
##   81  0 0 1
##   82  0 0 1
##   83  0 1 0
##   84  0 1 0
##   85  0 1 0
##   86  0 1 0
##   87  0 1 0
##   88  0 1 0
##   89  0 1 0
##   90  0 0 1
##   91  0 0 1
##   92  0 0 1
##   93  1 0 0
##   94  0 1 0
##   95  0 0 1
##   96  0 0 1
##   97  0 1 0
##   98  0 0 1
##   99  0 0 1
##   100 0 0 1
##   101 0 0 1
##   102 0 0 1
##   103 0 1 0
##   104 0 1 0
##   105 0 1 0
##   106 0 1 0
##   107 0 0 1
##   108 1 0 0
##   109 1 0 0
##   110 0 1 0
##   111 0 0 1
##   112 0 0 1
##   113 0 0 1
##   114 0 0 1
##   115 0 0 1
##   116 0 0 1
##   117 0 1 0
##   118 1 0 0
##   119 1 0 0
##   120 1 0 0
##   121 1 0 0
##   122 0 0 1
##   123 1 0 0
##   124 0 0 1
##   125 0 0 1
##   126 0 0 1
##   127 1 0 0
##   128 1 0 0
##   129 0 1 0
##   130 0 1 0
##   131 0 1 0
##   132 0 1 0
##   133 0 1 0
##   134 0 0 1
##   135 0 0 1
##   136 0 0 1
##   137 0 0 1
##   138 0 0 1
##   139 0 0 1
##   140 0 0 1
##   141 1 0 0
##   142 0 0 1
##   143 1 0 0
##   144 0 0 1
##   145 1 0 0
##   146 1 0 0
##   147 0 1 0
##   148 0 1 0
##   149 0 0 1
##   150 1 0 0
##   151 0 0 1
##   152 0 1 0
##   153 1 0 0
##   154 1 0 0
##   155 1 0 0
##   156 0 1 0
##   157 0 1 0
##   158 1 0 0
##   159 0 1 0
##   160 0 0 1
##   161 0 1 0
##   162 0 1 0
##   163 0 0 1
##   164 1 0 0
##   165 1 0 0
##   166 1 0 0
##   167 1 0 0
##   168 0 0 1
##   169 0 0 1
##   170 0 0 1
##   171 0 1 0
##   172 0 1 0
##   173 0 0 1
##   174 1 0 0
##   175 1 0 0
##   176 1 0 0
##   177 1 0 0
##   178 1 0 0
##   179 1 0 0
##   180 1 0 0
##   181 1 0 0
##   182 0 0 1
##   183 1 0 0
##   184 0 0 1
##   185 1 0 0
##   186 0 0 1
##   187 0 1 0
##   188 0 1 0
##   189 0 1 0
##   190 0 0 1
##   191 0 0 1
##   192 0 1 0
##   193 0 1 0
##   194 0 0 1
##   195 0 0 1
##   196 0 1 0
##   197 0 0 1
##   198 0 0 1
##   199 1 0 0
##   200 1 0 0
##   201 0 0 1
##   202 0 0 1
##   203 0 0 1
##   204 0 0 1
##   205 1 0 0
##   206 1 0 0
##   207 0 0 1
##   208 0 0 1
##   209 0 0 1
##   210 1 0 0
##   211 1 0 0
##   212 0 0 1
##   213 0 0 1
##   214 1 0 0
##   215 1 0 0
##   216 1 0 0
##   217 1 0 0
##   218 0 0 1
##   219 0 0 1
##   220 0 0 1
##   221 0 0 1
##   222 0 0 1
##   223 0 0 1
##   224 0 1 0
##   225 1 0 0
##   226 1 0 0
##   227 1 0 0
##   228 0 0 1
##   229 0 0 1
##   230 0 0 1
##   231 0 0 1
##   232 0 0 1
##   233 1 0 0
##   234 0 0 1
##   235 0 1 0
##   236 0 0 1
##   237 0 0 1
##   238 0 0 1
##   239 1 0 0
##   240 0 0 1
##   241 0 0 1
##   242 0 0 1
##   243 0 0 1
##   244 0 0 1
##   245 1 0 0
##   246 0 0 1
##   247 0 0 1
##   248 0 0 1
##   249 0 0 1
##   250 1 0 0
##   251 0 0 1
##   252 0 0 1
##   253 1 0 0
##   254 1 0 0
##   255 0 0 1
##   256 0 0 1
##   257 0 0 1
##   258 0 1 0
##   259 0 0 1
##   260 1 0 0
##   261 0 0 1
##   262 1 0 0
##   263 0 0 1
##   264 0 0 1
##   265 0 1 0
##   266 0 0 1
##   267 1 0 0
##   268 0 0 1
##   269 0 0 1
##   270 0 1 0
##   271 1 0 0
##   272 0 1 0
##   273 0 0 1
##   274 0 0 1
##   275 0 0 1
##   276 0 0 1
##   277 0 1 0
##   278 0 0 1
##   279 1 0 0
##   280 0 0 1
##   281 0 0 1
##   282 0 1 0
##   283 1 0 0
##   284 0 1 0
##   285 0 0 1
##   286 0 0 1
##   287 0 0 1
##   288 1 0 0
##   289 0 0 1
##   290 0 0 1
##   291 0 0 1
##   292 0 0 1
##   293 1 0 0
##   294 0 0 1
##   295 0 0 1
##   296 0 0 1
##   297 0 1 0
##   298 1 0 0
##   299 0 1 0
##   300 0 1 0
##   301 0 1 0
##   302 0 1 0
##   303 0 0 1
##   304 0 1 0
##   305 0 0 1
##   306 0 1 0
##   307 0 0 1
##   308 1 0 0
##   309 0 1 0
##   310 0 0 1
##   311 0 1 0
##   312 0 0 1
##   313 0 1 0
##   314 0 0 1
##   315 0 1 0
##   316 0 1 0
##   317 0 1 0
##   318 0 1 0
##   319 0 1 0
##   320 0 1 0
##   321 0 1 0
##   322 0 1 0
##   323 0 1 0
##   324 0 1 0
##   325 0 0 1
##   326 0 0 1
##   327 0 1 0
##   328 0 1 0
##   329 0 0 1
##   330 0 0 1
##   331 0 0 1
##   332 0 0 1
##   333 0 0 1
##   334 0 1 0
##   335 0 1 0
##   336 0 1 0
##   337 1 0 0
##   338 0 1 0
##   339 0 1 0
##   340 1 0 0
##   341 0 1 0
##   342 0 0 1
##   343 0 0 1
##   344 0 0 1
##   345 0 1 0
##   346 0 1 0
##   347 0 1 0
##   348 0 0 1
##   349 0 1 0
##   350 0 0 1
##   351 0 1 0
##   352 0 1 0
##   353 0 0 1
##   354 0 0 1
##   355 0 0 1
##   356 0 0 1
##   357 0 0 1
##   358 0 1 0
##   359 1 0 0
##   360 0 1 0
##   361 0 1 0
##   362 0 1 0
##   363 0 0 1
##   364 0 0 1
##   365 0 1 0
##   366 0 0 1
##   367 0 0 1
##   368 0 0 1
##   369 0 0 1
##   370 0 1 0
##   371 0 1 0
##   372 0 0 1
##   373 0 1 0
##   374 1 0 0
##   375 0 0 1
##   376 1 0 0
##   377 0 1 0
##   378 0 0 1
##   379 0 0 1
##   380 0 0 1
##   381 0 0 1
##   382 0 0 1
##   383 1 0 0
##   384 0 0 1
##   385 0 1 0
##   386 0 1 0
##   387 0 0 1
##   388 0 1 0
##   389 0 0 1
##   390 0 1 0
##   391 0 1 0
##   392 0 0 1
##   393 0 1 0
Clusters <- as.factor(pam.rf$cluster)
Species <- PI_parameters$sample_id
p3 <- PI_parameters %>%
  add_column(cluster = Clusters, .after = "sample_id") %>%
  ggplot(aes(x = AUC_death_mean, 
                            y =log(max_rate_death_mean), 
                            colour = cluster)) + 
  geom_point(size = 3) +
  scale_color_manual(values = c("orange", "red", "blue")) +
  theme_bw()
p4 <- PI_parameters %>%
  add_column(cluster = Clusters, .after = "sample_id") %>%
  ggplot(aes(x = AUC_death_mean, 
                            y =max_rate_death_mean, 
                            colour = cluster)) + 
  geom_point(size = 3) +
  scale_color_manual(values = c("orange", "red", "blue")) +
  theme_bw()
(plot_list <- list(p1, p2, p3,p4))
## [[1]]

## 
## [[2]]

## 
## [[3]]

## 
## [[4]]

plot_list %>%
  saveRDS("processed_data/RF_plots.Rda")

Plot on PCA axes

pca2$li %>%
 filter(Axis1 > 5) 
##            Axis1    Axis2    Axis3     Axis4     Axis5
## BPH3684 5.783284 3.679782 5.421054 -2.424074 -4.259186
## BPH3688 5.722108 3.578954 5.251910 -1.975804 -4.589938
pca2$li %>%
  ggplot(aes(x = Axis1, y = Axis2, col = Clusters)) +
   scale_color_manual(values = c("orange", "red", "blue")) +
  geom_point() +
  theme_bw()

fviz_pca_biplot(pca2,
             #select.ind = list(contrib = 10),
             axes = c(1,2),
             geom = c("point"),
             alpha.ind = .5,
             addEllipses = F,
             ellipse.level = .95,
             # col.ind = pca_meta.df4$cluster,
             title = paste("" ),
             repel = T,
             pointshape = 16)